/**
 * commitlint.config.js
 * commit 校验规则
 */
import typeEnum from './.cz-config';

module.exports = {
  extends: ['@commitlint/config-conventional'],
  rules: {
    'type-enum': [2, 'always', typeEnum.types.map((i) => i.value)],
    'scope-empty': [0, 'always'],
    'type-empty': [2, 'never'],
    'subject-empty': [2, 'never'],
    'msg-valid': [2, 'always']
  },
  plugins: [
    {
      rules: {
        'msg-valid': (subject) => {
          return [/.{1,50}/.test(subject), `commit信息格式不正确：`];
        }
      }
    }
  ]
};
